home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 July / EnigmA AMIGA RUN 20 (1997)(G.R. Edizioni)(IT)[!][issue 1997-07 & 08][EAR-CD IV].iso / earcd / dev / asm / ppcasmpk.lha / PPCASMPK / PPCASMPK.doc < prev    next >
Text File  |  1997-04-27  |  9KB  |  331 lines

  1. /=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/
  2.           PowerPC Assembler Pack for Amiga V1.0
  3.  
  4.                (RELEASE DATE 27.4.1997)
  5. /=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/
  6.  
  7. ··································································
  8. minimal Requirements:.......68000
  9. ··································································
  10. recommended Requirements:...68030 or 68060,
  11.                             AGA/gfxboard and Ks3.0 for the demo
  12. ··································································
  13.  
  14. Description
  15. -----------
  16. This is a Emulator/Disassembler intended for Assembler programmers
  17. wanting to develop PowerPC-routines on their 680x0 Amigas. To enable
  18. output, special meaning has been given to the instruction "sc" which
  19. makes calls to 680x0-AmigaOS possible(this is of course incompatible
  20. with PPC-system-calls in PowerUp-Amigas).
  21.  
  22. Rights
  23. ------
  24. This Package is Freeware!
  25. It may be redistributed/copied without explicit permission.
  26.  
  27. Author
  28. ------
  29. To contact me, send Email to:  midas@tomtec.abg.sub.org
  30.     
  31.  
  32. The Demo
  33. --------
  34. To get an idea of what kind of things can be done with this tool,
  35. see the EmulDemo-directory: 
  36.  
  37. PPCTEST.ASM is the source file for a small demo doing some 
  38.             graphics in a chunky buffer.
  39.  
  40. PPCTEST.P is the assembled File. It has a header of 9 Bytes,so
  41.           use offset=9 to run it
  42.  
  43.  
  44. If you don't want to mess around with the special 
  45. System-Call-mechanism, this Demo can serve you as a framework
  46. for your chunky PPC-routines.
  47.  
  48. To assemble the demo,use the AS V1.41 Cross-Assembler.
  49. Unfortunately,it has not yet been ported to the Amiga, so you'll
  50. have to use an MS-DOS emulator. Furthermore,this Version of
  51. that Assembler has some major bugs being worked around in the demo.
  52. See PPCTEST.ASM for information on those bugs.
  53.  
  54.  
  55. Usage
  56. -----
  57.  
  58. PPCASMPK <ppc-file> <offset> [e][d][r]
  59.        offset: offset of PPC-code in the file
  60.        "e":    specify this to emulate
  61.        "d":    specify this to disassemble
  62.  (use "ed" to disassemble while running)
  63.        "r":    add this to show registers after each inst
  64.  
  65. For example,to run the demo,you would type "PPCASMPK ppctest.p 9 e"
  66.  
  67.  
  68. For the 2 memory-addressing modes of the PowerPC,2 versions of the
  69.  emulator/disassembler are available:
  70.  
  71. ············································································
  72. PPCASMPK_LE for LittleEndian byte-ordering
  73.         ;   this means that 
  74.         ;              1.the 4 bytes of each INSTRUCTION are
  75.         ;                organized right-to-left in memory(msbs last)
  76.         ;           2.multiple-byte memory-accesses by the
  77.         ;                PPC store/load less significant bytes first
  78. ············································································
  79. PPCASMPK for BigEndian byte-ordering
  80.         ;   this means that 
  81.         ;             1.the 4 bytes of each INSTRUCTION are
  82.         ;               organized left-to-right in memory(msbs first)
  83.         ;          2.multiple-byte memory-accesses by the
  84.         ;               PPC store/load more significant bytes first
  85.         ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  86.         ;for example used in:........MacOS (PowerMac),PowerUp-Amiga
  87.         ;similar to:.................680x0
  88.         ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  89. ············································································
  90.  
  91.  
  92. Technical Details (also see tables at end of file)
  93. --------------------------------------------------
  94.  
  95.   _____emulates:______
  96.  /                    \
  97.  |     32bit-PPC      |
  98.  |                    |
  99.  |    restrictions:   |
  100.  |*NO* FPU            |
  101.  |*NO* interrupts     |
  102.  |*NO* supervisor-mode|
  103.  |(registers,mmu,ops) |
  104.  \____________________/
  105.  
  106.  -----------------------------
  107.  Conventions for the emulator:
  108.  -----------------------------
  109.  1. The program can exit with "blr"
  110.  2. r31 is the Stack,pointing behind the valid buffer
  111.     (if you need more stack for the emulation-code,
  112.      increase the stack of the PPCASMPK-Tool)
  113.  3. The code at the specified offset in the file is
  114.     emulated to reside at address 0. Because of this,
  115.     you can use absolute addressing without having to
  116.     relocate the code
  117.  4. r0 is the execbase (mapped into the PPC's address
  118.                         space)
  119.  5. you can get the address of a label by branching
  120.     immediately before it and letting the return-adr
  121.     be placed into the LR
  122.  6. Cache-flush operations all result in a flush of
  123.     the whole data-cache;Cache-hints are ignored
  124.  7. to enable output,the following has been implemented:
  125.  
  126.  Incompatible emulation of "sc" to enable call of 680X0-system routines
  127. ------------------------------------------------------------------------
  128.  r2 contains the address to jump to (in real-memory)
  129.  If r2 is 0, no call to 680X0-code is made.Use this to prepare pointers
  130.  before passing/evaluating structures etc.
  131.  
  132.  r16-r23 map to d0-d7
  133.  r24-r30 map to a0-a6 (a7 will be the emulator's stack)
  134.  
  135. >r0 contains a mask(PPC-numbered bit0 corresponding to r0,bit1 to r1...)
  136.  that specifies which registers contain addresses,that must be converted
  137.  to real addresses BEFORE the call
  138. >if a bit is 1 it means that the corresponding register must be converted
  139. >r1 does specify the registers that have to be converted back to
  140.  Zero-bound addresses AFTER the 680X0-routine returns
  141.  
  142.  !!!!!!!!!!!! IMPORTANT: if a register contains the value 0,it is not
  143.  !!!!!!!!!!!!            mapped! This makes error-testing at system-
  144.  !!!!!!!!!!!!            routines like AllocMem possible.
  145. ------------------------------------------------------------------------
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152. Tables
  153. ------
  154.  
  155.  
  156. supported registers
  157. @@@@@@@@@@@@@@@@@@@
  158. r0-r31    ;general purpose registers
  159. LR    ;link-register
  160. CT    ;count-register
  161. CR    ;condition-register
  162. XER    ;integer exception register
  163.  
  164.  
  165. throughout the following tables,"/x" indicates that an "o" and/or "." may
  166. be added to a mnemonic
  167.  
  168. instructions not supported by the emulator/disassembler:
  169. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  170.         cntlzd/x    (64-bit)
  171.         divd/x        (64-bit)
  172.         divdu/x        (64-bit)
  173.         eciwx        (hardware dependent)
  174.         ecowx        (hardware dependent)
  175.         extsw/x        (64-bit)
  176.         fabs/x        (FPU)
  177.         fadd/x        (FPU)
  178.         fadds/x        (FPU)
  179.         fcfid        (64-bit) (FPU)
  180.         fcmpo        (FPU)
  181.         fcmpu        (FPU)
  182.         fctid/x        (64-bit) (FPU)
  183.         fctidz/x    (64-bit) (FPU)
  184.         fctiw/x        (FPU)
  185.         fctiwz/x    (FPU)
  186.         fdiv/x        (FPU)
  187.         fdivs/x        (FPU)
  188.         fmadd/x        (FPU)
  189.         fmadds/x    (FPU)
  190.         fmr/x        (FPU)
  191.         fmsub/x        (FPU)
  192.         fmsubs/x    (FPU)
  193.         fmul/x        (FPU)
  194.         fmuls/x        (FPU)
  195.         fnabs/x        (FPU)
  196.         fneg/x        (FPU)
  197.         fnmadd/x    (FPU)
  198.         fnmadds/x    (FPU)
  199.         fnmsub/x    (FPU)
  200.         fnmsubs/x    (FPU)
  201.         fres/x        (FPU)
  202.         frsp/x        (FPU)
  203.         frsqrte        (FPU)
  204.         fsel/x        (FPU)
  205.         fsqrt/x        (FPU)
  206.         fsqrts/x    (FPU)
  207.         fsub/x        (FPU)
  208.         fsubs/x        (FPU)
  209.         ld        (64-bit)
  210.         ldarx        (64-bit)
  211.         ldu        (64-bit)
  212.         ldux        (64-bit)
  213.         ldx        (64-bit)
  214.         lfd        (FPU)
  215.         lfdu        (FPU)
  216.         lfdux        (FPU)
  217.         lfdx        (FPU)
  218.         lfs        (FPU)
  219.         lfsu        (FPU)
  220.         lfsux        (FPU)
  221.         lfsx        (FPU)
  222.         lwa        (64-bit)
  223.         lwaux        (64-bit)
  224.         lwax        (64-bit)
  225.         mcrfs        (FPU)    
  226.         mffs/x        (FPU)
  227.         mfsr        (supervisor)
  228.         mfsrin        (supervisor)
  229.         mtfsb0/x    (FPU)
  230.         mtfsb1/x    (FPU)
  231.         mtfsf/x        (FPU)
  232.         mtfsfi/x    (FPU)
  233.         mtmsr        (supervisor)
  234.         mtsr        (supervisor)
  235.         mtsrin        (supervisor)
  236.         mulhd        (64-bit)
  237.         mulhdu        (64-bit)
  238.         mulld        (64-bit)
  239.         rfi        (supervisor)
  240.         rldcl        (64-bit)
  241.         rldcr        (64-bit)
  242.         rldic        (64-bit)
  243.         rldicl        (64-bit)
  244.         rldicr        (64-bit)
  245.         rldimi        (64-bit)
  246.         slbia        (64-bit) (supervisor)
  247.         slbie        (64-bit) (supervisor)
  248.         sld/x        (64-bit)
  249.         srad/x        (64-bit)
  250.         sradi/x        (64-bit)
  251.         srd/x        (64-bit)
  252.         std        (64-bit)
  253.         stdcx.        (64-bit)
  254.         stdu        (64-bit)
  255.         stdux        (64-bit)
  256.         stdx        (64-bit)
  257.         stfd        (FPU)
  258.         stfdu        (FPU)
  259.         stfdux        (FPU)
  260.         stfdx        (FPU)
  261.         stfiwx        (FPU)
  262.         stfs        (FPU)
  263.         stfsu        (FPU)
  264.         stfsux        (FPU)
  265.         stfsx        (FPU)
  266.         td        (64-bit)
  267.         tdi        (64-bit)
  268.         tlbia        (MMU) (optional)
  269.         tlbie        (MMU) (optional)
  270.         tlbsync        (MMU) (optional)
  271.         tw        (interrupts)
  272.         twi        (interrupts)
  273.             
  274.  
  275.  
  276.  
  277. implemented in 603e but optional for PowerPC:
  278. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  279.         fres/x
  280.         frsqrte/x
  281.         fsel/x
  282.         stfiwx
  283.         tlbie
  284.         tlbld
  285.         tlbsync
  286.  
  287.  
  288. not implemented in 603e:
  289. @@@@@@@@@@@@@@@@@@@@@@@@
  290.         cntlzd/x    (64-bit)
  291.         divd/x        (64-bit)
  292.         divdu/x        (64-bit)
  293.         extsw/x        (64-bit)
  294.         fcfid/x        (64-bit)
  295.         fctld/x        (64-bit)
  296.         fctldz/x    (64-bit)
  297.         fsqrt/x        (optional)
  298.         fsqrts/x    (optional)
  299.         ld        (64-bit)
  300.         ldarx        (64-bit)
  301.         ldu        (64-bit)
  302.         ldux        (64-bit)
  303.         ldx        (64-bit)
  304.         lwa        (64-bit)
  305.         lwaux        (64-bit)
  306.         lwax        (64-bit)
  307.         mulhd/x        (64-bit)
  308.         mulhdu/x    (64-bit)
  309.         mulld/x        (64-bit)
  310.         rldcl/x        (64-bit)
  311.         rldcr/x        (64-bit)
  312.         rldic/x        (64-bit)
  313.         rldicl/x    (64-bit)
  314.         rldicr/x    (64-bit)
  315.         rldimi/x    (64-bit)
  316.         slbia        (64-bit)
  317.         slbie        (64-bit)
  318.         sld/x        (64-bit)
  319.         srad/x        (64-bit)
  320.         sradl/x        (64-bit)
  321.         srd/x        (64-bit)
  322.         std        (64-bit)
  323.         stdcx.        (64-bit)
  324.         stdu        (64-bit)
  325.         stdux        (64-bit)
  326.         stdx        (64-bit)
  327.         td        (64-bit)
  328.         tdl        (64-bit)
  329.         
  330.  
  331.